package com.itheima.aop;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * TODO
 *
 * @Author mr.wu
 * @Data #{DATE} #{TIME}
 */
@Aspect
@Component
public class TimeAspect01 {

    @Pointcut("execution (* com.itheima.service.*.*(..))")
    public void init(){}

    @Around("init()")
    public Object timeAspect(ProceedingJoinPoint joinPoint) throws Throwable {
        Long start = System.currentTimeMillis();
        String name = joinPoint.getSignature().getName();
        //获取原方法的全类名
        String declaringTypeName = joinPoint.getSignature().getDeclaringTypeName();
        //获取参数
        Object arg = joinPoint.getArgs()[0];
        //获取切点被切的实例全类名（即目标对象）
        String name1 = joinPoint.getTarget().getClass().getName();
        Long end = System.currentTimeMillis();
        Object proceed = joinPoint.proceed();
        return proceed;

    }

}
